package com.zx._01_基础._029_JNI;

/**
 * 动态库接口
 *
 * 生成头文件：在D:\workspace\ba\TestJni\TestJNA\target\classes
 * javah -jni com.zx._01_基础._029_JNI.Lib
 *
 * @author xin.chong
 */
public class Lib {

    static {
        System.load("D:\\workspace\\my_cpp_lib\\cmake-build-debug\\libmy_cpp_lib.dll");
    }

    public static void main(String[] args) {
        int result = Lib.sum(1, 3);
        System.out.print("恭喜，JNI 第一个程序成功 ，the  result is  " + result);
    }

    /**
     * 动态库的函数接口
     *
     * @param a
     * @param b
     * @return
     */
    public static native int sum(int a, int b);
}